home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C12 / FeeFi2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  438 b   |  27 lines

  1. //: C12:FeeFi2.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Copying vs. initialization
  7.  
  8. class Fi {};
  9.  
  10. class Fee {
  11. public:
  12.   Fee(int) {}
  13.   Fee(const Fi&) {}
  14. };
  15.  
  16. class Fo {
  17.   int i;
  18. public:
  19.   Fo(int x = 0) { i = x; }
  20.   operator Fee() const { return Fee(i); }
  21. };
  22.  
  23. int main() {
  24.   Fo fo;
  25.   Fee fiddle = fo;
  26. } ///:~
  27.